package com.shyroke.daydayzhuanweb;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.filter.ShallowEtagHeaderFilter;

import javax.servlet.Filter;

@SpringBootApplication
@MapperScan("com.shyroke.daydayzhuandao.mapper")
@EnableJpaRepositories("com.shyroke.daydayzhuandao.respository")
@EntityScan("com.shyroke.daydayzhuanapi.entity")
@ComponentScan("com.shyroke")
@EnableScheduling
@EnableCaching(proxyTargetClass = true)
@EnableAsync(proxyTargetClass = true)
public class DaydayzhuanWebApplication  {

    public static void main(String[] args) {
        SpringApplication.run(DaydayzhuanWebApplication.class, args);
    }

    @Bean
    public Filter filter(){
        ShallowEtagHeaderFilter filter = new ShallowEtagHeaderFilter();
        return filter;
    }

    @Bean
    public TaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setPoolSize(10);
        return taskScheduler;
    }

}

